<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <ui:composition template="templates/template.xhtml">
        <h:head>
            <title>Seja bem-vindo ao ThreeDs!</title>
        </h:head>
        <ui:define name="content">
            <h:body>
                <h:form>
                    <center>
                    <!-- Painel -->
                    <p:panel id="panel" header="#{msgs.esquema}">  
                        <h:panelGrid columns="3">  

                            <h:outputLabel for="nome" value="#{msgs.nome}: *" />  
                            <p:inputText id="nome" label="Nome" required="true" requiredMessage="#{msgs.campoobrigatorio}"
                                         value="#{esquemaBean.esquema.nome}" size="50" maxlength="100" />
                            <p:message for="nome" />  

                            <h:outputLabel for="descricao" value="#{msgs.descricao}: *"/>
                            <p:inputTextarea id="e-mail" label="descrcao" style="width: 423px" required="true"  requiredMessage="#{msgs.campoobrigatorio}"
                                             value="#{esquemaBean.esquema.descricao}" />
                            <p:message for="descricao" />  

                            <h:outputLabel for="categoria" value="#{msgs.categoria}: *"/> 
                            <p:inputText value="#{esquemaBean.esquema.categoria}" size="50" maxlength="20" id="descricao" 
                                        label="descricao" required="true"  requiredMessage="#{msgs.campoobrigatorio}"/>
                            <p:message for="descricao" />  
                            
                             <h:outputLabel for="bancodados" value="#{msgs.bancodados}: *"/> 
                             <p:inputText value="#{esquemaBean.esquema.nomeBd}" size="50" maxlength="20" id="bancodados" 
                                        label="bancodados" required="true"  requiredMessage="#{msgs.campoobrigatorio}"/>
                            <p:message for="bancodados" /> 
                            
                             <h:outputLabel for="esquema" value="#{msgs.esquema}: *"/> 
                             <p:inputText value="#{esquemaBean.esquema.nomeProjeto}" size="50" maxlength="20" id="esquema" 
                                        label="esquema" required="true"  requiredMessage="#{msgs.campoobrigatorio}"/>
                            <p:message for="esquema" /> 
                            
                            
                        </h:panelGrid>  
                    </p:panel>              
                    

                    <!-- Botões -->



                    <br>
                        <p:commandButton id="salvar" value="#{msgs.salvar}" actionListener="#{esquemaBean.salvar()}" update="panel,resultado" 
                                     image="ui-icon ui-icon-disk" title="Salvar" process="@this,panel"/>

                       
             
                    </br>

                    <br></br>
                    <!-- Tabela -->
                    <p:dataTable id="resultado" var="esquema" value="#{esquemaBean.esquemas}" 
                                 selection="#{esquemaBean.esquema}" selectionMode="single" 
                                 update="panel">

                        <f:facet name="header">
                            #{msgs.resultados}
                        </f:facet>

                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="#{msgs.nome}"/>
                            </f:facet>
                            <h:outputText value="#{esquema.nome}"/>
                        </p:column>

                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="#{msgs.descricao}"/>
                            </f:facet>
                            <h:outputText value="#{esquema.descricao}"/>
                        </p:column>
                        
                         <p:column>
                            <f:facet name="header">
                                <h:outputText value="#{msgs.categoria}"/>
                            </f:facet>
                             <h:outputText value="#{esquema.categoria}"/>
                        </p:column>
                      

                    </p:dataTable>  
                    </center>
                    </h:form>
                    <h:form>
                        <center>
                        <br>
                    <p:commandButton value="#{msgs.voltar}" image="imagens/new_project.png" action="visualizarEsquemas.xhtm" ajax="false"/>
                    <f:param name="productId" value="20"/>
                   </br>
                            </center>
                    </h:form>
                  
                

            </h:body>
        </ui:define>

    </ui:composition>
</html>